import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { Type } from 'class-transformer';
import { IsArray, IsNotEmpty, IsNumber, IsOptional, IsString } from 'class-validator';

export class FindJobFairsDto {
  @ApiProperty({ description: '页码' })
  @Type(() => Number)
  @IsNumber()
  page: number = 1;

  @ApiProperty({ description: '条数' })
  @Type(() => Number)
  @IsNumber()
  size: number = 10;

  @ApiPropertyOptional({ description: '启用状态' })
  @IsOptional()
  @Type(() => Number)
  @IsNumber()
  enableStatus?: number;
}

export class CreateJobFairsDto {
  @ApiProperty({ description: '标题' })
  @IsNotEmpty()
  @IsString()
  title: string;

  @ApiProperty({ description: '宣传海报' })
  @IsNotEmpty()
  @IsString()
  image: string;

  @ApiProperty({ description: '开始时间' })
  @IsNotEmpty()
  @IsString()
  startTime: string;

  @ApiProperty({ description: '结束时间' })
  @IsNotEmpty()
  @IsString()
  endTime: string;

  @ApiProperty({ description: '地点' })
  @IsNotEmpty()
  @IsString()
  address: string;

  @ApiProperty({ description: '状态' })
  @IsNotEmpty()
  @IsNumber()
  enableStatus: number;
}

export class UpdateJobFairsDto extends CreateJobFairsDto {
  @ApiProperty({ description: 'ID' })
  @IsNotEmpty()
  @IsNumber()
  id: number;
}

export class SetJobFairsCompany {
  @ApiProperty({ description: '招聘会ID' })
  @IsOptional()
  @IsNumber()
  id?: number;

  @ApiProperty({ description: '公司ID列表' })
  @IsNotEmpty()
  @IsArray()
  ids: number[];
}
